"""
开放商户 - 结算账户变更相关模型
"""

from jlpay.model.base import OrgBaseReq, BaseResponse
from jlpay.utils.annotation_utils import Encrypt, SensitiveField


@Encrypt  # 标记整个类需要加密处理
class SettleAccountChangeRequest(OrgBaseReq):
    """结算账户变更请求"""
    
    API_URL = "/open/merch/access/settle-info/modify"
    
    def __init__(self):
        """初始化结算账户变更请求"""
        super().__init__()
        self.apply_id = None
        self.merch_no = None
        self.settle_type = None
        self.account_name = None
        self.account_no = None
        self.bank_code = None
        self.bank_branch_id = None
        self.bank_branch_name = None
        self.account_pic = None
        self.bank_set_phone = None
        self.cert_type = None
        self.delegatee_id_card = None
        self.delegatee_cert_period_begin = None
        self.delegatee_cert_period_end = None
        self.acct_license = None
        self.acct_cert_front_pic = None
        self.acct_cert_back_pic = None
        self.acct_auth_letter = None
        self.identity_face_pic = None
        self.acct_face_pic = None
        self.proof_info = None
        
        # 定义敏感字段路径
        self._sensitive_fields = [
            SensitiveField("account_name"),      # 结算账户名
            SensitiveField("account_no"),        # 账号
            SensitiveField("bank_set_phone"),    # 预留银行手机号码
            SensitiveField("delegatee_id_card"), # 收款人证件号码
        ]
    
    def get_sensitive_fields(self):
        """
        返回需要加密的敏感字段路径列表
        
        Returns:
            包含敏感字段路径的列表
        """
        return self._sensitive_fields
    
    def set_apply_id(self, apply_id):
        """
        设置业务申请编号
        
        Args:
            apply_id: 业务申请编号
            
        Returns:
            SettleAccountChangeRequest实例
        """
        self.apply_id = apply_id
        return self
    
    def set_merch_no(self, merch_no):
        """
        设置商户号
        
        Args:
            merch_no: 商户号
            
        Returns:
            SettleAccountChangeRequest实例
        """
        self.merch_no = merch_no
        return self
    
    def set_settle_type(self, settle_type):
        """
        设置结算类型
        
        Args:
            settle_type: 结算类型
            
        Returns:
            SettleAccountChangeRequest实例
        """
        self.settle_type = settle_type
        return self
    
    def set_account_name(self, account_name):
        """
        设置结算账户名
        
        Args:
            account_name: 结算账户名
            
        Returns:
            SettleAccountChangeRequest实例
        """
        self.account_name = account_name
        return self
    
    def set_account_no(self, account_no):
        """
        设置账号
        
        Args:
            account_no: 账号
            
        Returns:
            SettleAccountChangeRequest实例
        """
        self.account_no = account_no
        return self
    
    def set_bank_code(self, bank_code):
        """
        设置开户银行
        
        Args:
            bank_code: 开户银行
            
        Returns:
            SettleAccountChangeRequest实例
        """
        self.bank_code = bank_code
        return self
    
    def set_bank_branch_id(self, bank_branch_id):
        """
        设置开户支行编号
        
        Args:
            bank_branch_id: 开户支行编号
            
        Returns:
            SettleAccountChangeRequest实例
        """
        self.bank_branch_id = bank_branch_id
        return self
    
    def set_bank_branch_name(self, bank_branch_name):
        """
        设置开户支行名称
        
        Args:
            bank_branch_name: 开户支行名称
            
        Returns:
            SettleAccountChangeRequest实例
        """
        self.bank_branch_name = bank_branch_name
        return self
    
    def set_account_pic(self, account_pic):
        """
        设置结算账户照片
        
        Args:
            account_pic: 结算账户照片
            
        Returns:
            SettleAccountChangeRequest实例
        """
        self.account_pic = account_pic
        return self
    
    def set_bank_set_phone(self, bank_set_phone):
        """
        设置预留银行手机号码
        
        Args:
            bank_set_phone: 预留银行手机号码
            
        Returns:
            SettleAccountChangeRequest实例
        """
        self.bank_set_phone = bank_set_phone
        return self
    
    def set_cert_type(self, cert_type):
        """
        设置收款人证件类型
        
        Args:
            cert_type: 收款人证件类型
            
        Returns:
            SettleAccountChangeRequest实例
        """
        self.cert_type = cert_type
        return self
    
    def set_delegatee_id_card(self, delegatee_id_card):
        """
        设置收款人证件号码
        
        Args:
            delegatee_id_card: 收款人证件号码
            
        Returns:
            SettleAccountChangeRequest实例
        """
        self.delegatee_id_card = delegatee_id_card
        return self
    
    def set_delegatee_cert_period_begin(self, delegatee_cert_period_begin):
        """
        设置收款人证件有效期开始日期
        
        Args:
            delegatee_cert_period_begin: 收款人证件有效期开始日期
            
        Returns:
            SettleAccountChangeRequest实例
        """
        self.delegatee_cert_period_begin = delegatee_cert_period_begin
        return self
    
    def set_delegatee_cert_period_end(self, delegatee_cert_period_end):
        """
        设置收款人证件有效期结束日期
        
        Args:
            delegatee_cert_period_end: 收款人证件有效期结束日期
            
        Returns:
            SettleAccountChangeRequest实例
        """
        self.delegatee_cert_period_end = delegatee_cert_period_end
        return self
    
    def set_acct_license(self, acct_license):
        """
        设置结算账户公司营业执照照片
        
        Args:
            acct_license: 结算账户公司营业执照照片
            
        Returns:
            SettleAccountChangeRequest实例
        """
        self.acct_license = acct_license
        return self
    
    def set_acct_cert_front_pic(self, acct_cert_front_pic):
        """
        设置结算账户人的身份证件正面
        
        Args:
            acct_cert_front_pic: 结算账户人的身份证件正面
            
        Returns:
            SettleAccountChangeRequest实例
        """
        self.acct_cert_front_pic = acct_cert_front_pic
        return self
    
    def set_acct_cert_back_pic(self, acct_cert_back_pic):
        """
        设置结算账户人的身份证件反面
        
        Args:
            acct_cert_back_pic: 结算账户人的身份证件反面
            
        Returns:
            SettleAccountChangeRequest实例
        """
        self.acct_cert_back_pic = acct_cert_back_pic
        return self
    
    def set_acct_auth_letter(self, acct_auth_letter):
        """
        设置结算账户收款确认书
        
        Args:
            acct_auth_letter: 结算账户收款确认书
            
        Returns:
            SettleAccountChangeRequest实例
        """
        self.acct_auth_letter = acct_auth_letter
        return self
    
    def set_identity_face_pic(self, identity_face_pic):
        """
        设置法人人脸图片
        
        Args:
            identity_face_pic: 法人人脸图片
            
        Returns:
            SettleAccountChangeRequest实例
        """
        self.identity_face_pic = identity_face_pic
        return self
    
    def set_acct_face_pic(self, acct_face_pic):
        """
        设置结算账户人脸图片
        
        Args:
            acct_face_pic: 结算账户人脸图片
            
        Returns:
            SettleAccountChangeRequest实例
        """
        self.acct_face_pic = acct_face_pic
        return self
    
    def set_proof_info(self, proof_info):
        """
        设置辅助证明材料
        
        Args:
            proof_info: 辅助证明材料
            
        Returns:
            SettleAccountChangeRequest实例
        """
        self.proof_info = proof_info
        return self


class SettleAccountChangeResponse(BaseResponse):
    """结算账户变更响应"""
    
    def __init__(self, response_dict=None):
        """初始化结算账户变更响应"""
        super().__init__(response_dict)
        self.merch_no = None
        self.apply_id = None
        
        if response_dict:
            self.merch_no = response_dict.get('merch_no')
            self.apply_id = response_dict.get('apply_id') 